home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13643 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: druid.borland.com!usenet
  2. From: pete@borland.com (Pete Becker)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: static members of a class template
  5. Date: 26 Mar 1996 20:45:33 GMT
  6. Organization: Borland International
  7. Message-ID: <4j9l1d$gnm@druid.borland.com>
  8. References: <315781CB.2DD1@digex.net> <4j99ts$num@piper.logicon.com>
  9. NNTP-Posting-Host: pbecker.borland.com
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=ISO-8859-1
  12. X-Newsreader: WinVN 0.99.5
  13.  
  14. In article <4j99ts$num@piper.logicon.com>, kkolda@logicon.com says...
  15. >
  16. >In article <315781CB.2DD1@digex.net>, yami@digex.net says...
  17. >>
  18. >>Hi,
  19. >>
  20. >>How would you go about declaring a static member of a class template?  
  21. >>Example:
  22. >>
  23. >>template<class kind>
  24. >>class simple {
  25. >>    private:
  26. >>        static kind someVar;
  27. >>};
  28. >>
  29. >>simple<kind> kind simple::someVar;
  30. >>
  31. >>
  32. >>This seems to follow the general pattern for defining and declaring a 
  33. >>static member, but it results in a syntax error.  What's the problem?
  34. >>
  35. >>Thanks in advance for any advice!
  36. >>
  37. >>-Steve-
  38. >
  39. >
  40. >I think what you want is as follows:
  41. >
  42. >template simple<class kind> kind simple<kind>::someVar;
  43. >
  44. >where you could also add initialization info if desired.
  45.  
  46. Please don't make things up. Look at real code, or try it with a compiler.
  47.  
  48. template <class kind> kind simple<kind>::someVar;
  49.  
  50.